package com.android.BluethootChess.activity;

import com.android.BluethootChess.activity.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * WelcomeActivity class that is used when the menu is loaded for the user.
 */
public class WelcomeActivity extends Activity {
	/** Called when the activity is first created. */

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		// new game button
		Button newGame = (Button) findViewById(R.id.newGameButton);
		newGame.setOnClickListener(new View.OnClickListener() {
			public void onClick(View view) {
				Intent myIntent = new Intent(view.getContext(),
						NewGameActivity.class);
				startActivity(myIntent);
				quitProcess();
			}

		});

		// chat button
		Button chat = (Button) findViewById(R.id.chatButton);
		chat.setOnClickListener(new View.OnClickListener() {
			public void onClick(View view) {
				Intent myIntent = new Intent(view.getContext(),
						BluetoothChat.class);
				startActivity(myIntent);
				quitProcess();
			}

		});

		// exit button
		Button exit = (Button) findViewById(R.id.exitButton);
		exit.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
				quitProcess();
			}
		});
	}

	/**
	 * Quits the current process.
	 */
	protected void quitProcess() {
		super.onDestroy();
		// After this is called, your app process is no longer available in DDMS
		android.os.Process.killProcess(android.os.Process.myPid());
	}

}